/*  Copyright (C) 2008 Davide Andreoli (see AUTHORS)
 *
 *  This file is part of edgar.
 *  edgar is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  edgar is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with edgar.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef E_MOD_MAIN_H
#define E_MOD_MAIN_H


/* Increment for Major Changes */
#define MOD_CONFIG_FILE_EPOCH      2
/* Increment for Minor Changes (ie: user doesn't need a new config) */
#define MOD_CONFIG_FILE_GENERATION 1
#define MOD_CONFIG_FILE_VERSION \
   ((MOD_CONFIG_FILE_EPOCH * 1000000) + MOD_CONFIG_FILE_GENERATION)


#define EDGAR_GUARDIAN_TYPE_EACTION 1
#define EDGAR_GUARDIAN_TYPE_COMMAND 2
#define EDGAR_GUARDIAN_TYPE_GETURL 3

#define EDGAR_GUARDIAN_DENY 1
#define EDGAR_GUARDIAN_ALLOW 2
#define EDGAR_GUARDIAN_DENY_ALL 3
#define EDGAR_GUARDIAN_ALLOW_ALL 4
#define EDGAR_GUARDIAN_IN_WAIT 5
#define EDGAR_GUARDIAN_ASK 6
#define EDGAR_GUARDIAN_DENY_LAST 7

/* Contain whole module conf */
typedef struct {
   int version;
   E_Module *module;
   E_Config_Dialog *cfd;
   Eina_Hash *conf_items_hash;
   Eina_Hash *conf_guardian_hash;
}Config;

/* This struct used to hold config for individual gadget */
typedef struct {
   const char *id;
   Eina_Hash *data_hash;
}Config_Item;

/* This struct used to hold data for every gadgets */
typedef struct {
   const char *val_str;
   int val_int;
   double val_float;
}Data_Item;

/* This define the items of the guardian hash */
typedef struct {
   int allow;
}Guardian_Item;

/* Visual instance of the gadget */
typedef struct {
   E_Gadcon_Client *gcc;
   Evas_Object *obj;
   Config_Item *ci;
   int min_w;
   int min_h;
}Instance;

/* Used to hold data for Ecor_Exe operation */
typedef struct {
   Instance *inst;
   int id_msg;
   const char *last_line;
}Edgar_Exe_Data;


EAPI extern E_Module_Api e_modapi;

EAPI void *e_modapi_init(E_Module *m);
EAPI int e_modapi_shutdown(E_Module *m);
EAPI int e_modapi_save(E_Module *m);

EAPI E_Config_Dialog *e_int_config_edgar_module(E_Container *con, const char *params);

#endif
